﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl" %>
<% using (Ajax.BeginForm("Update", "NhatKyBanHang", new AjaxOptions { UpdateTargetId = "list_NKBH" }, new { name = "FormNhatKyBanHang" }))
   {
       %>
        <%: Html.TextBox("ngayban_edit", (string)ViewData["ngayban_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("chuhang_edit", (string)ViewData["chuhang_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("diachi_edit", (string)ViewData["diachi_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("phanloai_edit", (string)ViewData["phanloai_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("thanhtoan_edit", (string)ViewData["thanhtoan_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("xetangbo_edit", (string)ViewData["xetangbo_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("diadiemtangbo_edit", (string)ViewData["diadiemtangbo_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("xevanchuyen_edit", (string)ViewData["xevanchuyen_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("sanpham_edit", (string)ViewData["sanpham_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("nhapxuat_edit", (string)ViewData["nhapxuat_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("bentravanchuyen_edit", (string)ViewData["bentravanchuyen_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("khachhang_edit", (string)ViewData["khachhang_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("ghichu_edit", (string)ViewData["ghichu_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("pagesize_edit", (string)ViewData["pagesize_sendedit"], new { style = "display:none;" })%>
            <%: Html.TextBox("page_edit", (string)ViewData["page_sendedit"], new { style = "display:none;" })%>
            <%
       Data.DBOES.NhatKyBanHang obj = (Data.DBOES.NhatKyBanHang)ViewData["DataNKBH"];
       if (obj != null)
       {
       %>
           
        <table width="100%">
        <tr>
            <td style="padding-left:10px">Mã NKBH:</td>
            <td><span class="AddNew"><input type="text"  name="IdNKBH" value="<%= obj.IdNKBH %>" readonly="readonly"/></span></td>
            <td>Ngày bán:</td>
            <td><span class="AddNew"><input type="text" class = "datepicker" name="NgayBan" id="NgayBan" value="<%= ((DateTime)obj.NgayBan).ToString("dd/MM/yyyy") %>"/></span></td>
            <td>Chủ hàng:</td>
            <td><span class="AddNew"><input type="text"  name="ChuHang" value="<%= obj.ChuHang %>"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Địa chỉ:</td>
            <td><span class="AddNew"><input type="text"  name="DiaChi" value="<%= obj.DiaChi %>"/></span></td>
            <td>Trả tiền muối nhập:</td>
            <td><%: Html.CheckBox("TraTienMuoiNhap",LamSon.Commons.DataTypeProtect.ProtectBoolean(obj.TraTienMuoiNhap,false)) %></td>
            <td>Xe tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="XeTangBo" value="<%= obj.SoXeTangBo %>"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Cước xe tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="CuocXeTangBo" id="CuocXeTangBo"  value="<%= obj.CuocXeTangBo %>"/></span></td>
            <td>Điểm tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="DiemTangBo" value="<%= obj.DiaDiemTangBo %>"/></span></td>
            <td>Số lượng:</td>
            <td><span class="AddNew"><input type="text" name="SoLuong" id="SoLuong" value="<%= obj.SoLuong %>"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Xe vận chuyển:</td>
            <td><span class="AddNew"><input type="text" name="XeVanChuyen"  value="<%= obj.SoXeVanChuyen %>"/></span></td>
            <td>Cước vận chuyển:</td>
            <td><span class="AddNew"><input type="text"  name="CuocVanChuyen" id="CuocVanChuyen" value="<%= obj.CuocXeVanChuyen %>"/></span></td>
            <td>Sản phẩm</td>
            <td class="Col2"> <select name="SanPham">
                     <option value="Hạt">Hạt</option>
                     <option value="Xay">Xay</option>
                     <option value="Sấy">Sấy</option>
                     <option value="Hầm">Hầm</option>
                     <option value="Lót bạt">Lót bạt</option>
                </select></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Giá nhập:</td>
            <td><span class="AddNew"><input type="text" name="GiaNhap" id="GiaNhap"  value="<%= obj.GiaNhap %>"/></span></td>
            <td>Phân loại :</td>
            <td class="Col2"><select  name="PhanLoai">
                     <option value="Đ">Đ</option>
                     <option value="T">T</option>
                     <option value="X">X</option>
                </select></td>
            <td>Khách hàng :</td>
             <td class="Col2"><select name="KhachHang" style="width:140px">
             <% List<Data.DBOES.Membership> objList=(List<Data.DBOES.Membership>)ViewData["KhachHang"];
                foreach (var obj1 in objList)
                {
                    if (obj.IdKhachHang == obj1.IdMembership)
                    {
                    %>
                    <option value="<%: obj1.IdMembership %>" selected><%= obj1.MembershipName%></option>
                    <%
}
                    else
                    { 
                     %>
                    <option value="<%: obj1.IdMembership %>"><%= obj1.MembershipName%></option>
                    <%
                    }
                }
             %>
                </select></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Giá xuất:</td>
            <td><span class="AddNew"><input type="text"  name="GiaXuat" id="GiaXuat" value="<%= obj.GiaXuat %>"/></span></td>
            <td>Bên trả vận chuyển :</td>
            <td class="Col2"><select  name="BenTraVanChuyen">
                     <option value="Công ty Lam Sơn">Công ty Lam Sơn</option>
                     <option value="Khách hàng">Khách hàng</option>
                </select></td>
            <td>Diễn giải :</td>
            <td><span class="AddNew"><input type="text"  name="ChuThich" id="ChuThich" value="<%= obj.GhiChu %>"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Bao bì bốc vác:</td>
            <td><span class="AddNew"><input type="text" name="BBBV" id="BBBV"  value="<%= obj.GiaBaoBiBocVac %>"/></span></td>
            <td>Thanh toán trước</td>
            <td><span class="AddNew"><input type="text" name="ThanhToanTruoc" value="<%= obj.ThanhToanTruoc %>"  id="ThanhToanTruoc" /></span></td>
            <td>Hình thức TT</td>
            <td><span class="AddNew"><input type="text" name="HinhThucTT" value="<%= obj.HinhThucTT %>"  id="HinhThucTT" /></span></td>
            
        </tr>
         <tr>
            <td>Trả cước TB :</td>
            <td><%: Html.CheckBox("TraCuocTB", LamSon.Commons.DataTypeProtect.ProtectBoolean(obj.TraCuocTB, false))%></td>
            <td>Trả cước VC :</td>
            <td><%: Html.CheckBox("TraCuocVC", LamSon.Commons.DataTypeProtect.ProtectBoolean(obj.TraCuocVC, false))%></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td colspan="6"><div class="Submit">
        	<ul>
            	<li class="Cancel"><a href="javascript:SubmitButton('cancle')">Hủy</a><input type="reset" style="display:none" name="btnCancel"/></li>
                <li class="Adds"><a href="javascript:SubmitButton('add')">Thêm</a><input type="submit" style="display:none" name="btnAdd" /></li>
            </ul>
        </div></td>
        </tr>
        </table>        
         
        <%
       }
       else
       { 
        %>
        <table width="100%">
        <tr>
            <td style="padding-left:10px">Mã NKBH:</td>
            <td><span class="AddNew"><input type="text"  name="IdNKBH" readonly="readonly"/></span></td>
            <td>Ngày bán:</td>
            <td><span class="AddNew"><input type="text" class = "datepicker" name="NgayBan"/></span></td>
            <td>Chủ hàng:</td>
            <td><span class="AddNew"><input type="text"  name="ChuHang"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Địa chỉ:</td>
            <td><span class="AddNew"><input type="text"  name="DiaChi"/></span></td>
            <td>Trả tiền muối nhập :</td>
            <td><%: Html.CheckBox("TraTienMuoiNhap",false) %></td>
            <td>Xe tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="XeTangBo"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Cước xe tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="CuocXeTangBo" /></span></td>
            <td>Điểm tăng bo:</td>
            <td><span class="AddNew"><input type="text" name="DiemTangBo"/></span></td>
            <td>Số lượng:</td>
            <td><span class="AddNew"><input type="text" name="SoLuong"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Xe vận chuyển:</td>
            <td><span class="AddNew"><input type="text" name="XeVanChuyen" /></span></td>
            <td>Cước vận chuyển:</td>
            <td><span class="AddNew"><input type="text"  name="CuocVanChuyen"/></span></td>
            <td>Sản phẩm</td>
            <td class="Col2"><select name="SanPham">
                     <option value="Hạt">Hạt</option>
                     <option value="Xay">Xay</option>
                     <option value="Sấy">Sấy</option>
                     <option value="Hầm">Hầm</option>
                     <option value="Lót bạt">Lót bạt</option>
                </select></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Giá nhập:</td>
            <td><span class="AddNew"><input type="text" name="GiaNhap" /></span></td>
            <td>Phân loại :</td>
            <td class="Col2"><select name="PhanLoai">
                     <option value="Đ">Đ</option>
                     <option value="T">T</option>
                     <option value="X">X</option>
                </select></td>
            <td>Khách hàng :</td>
             <td class="Col2"><select name="KhachHang" style="width:130px">
             <% List<Data.DBOES.Membership> objList=(List<Data.DBOES.Membership>)ViewData["KhachHang"];
                foreach (var obj2 in objList)
                { 
                    %>
                    <option value="<%: obj2.IdMembership %>"><%= obj2.MembershipName %></option>
                    <%
                }
             %>
                </select><a href="Search_KH.aspx" id="Search_KhachHang"><img height="20" alt="" src="/Content/images/search_user.png" /></a></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Giá xuất:</td>
            <td><span class="AddNew"><input type="text"  name="GiaXuat"/></span></td>
            <td>Bên trả vận chuyển :</td>
            <td class="Col2"><select name="BenTraVanChuyen">
                     <option value="Công ty Lam Sơn">Công ty Lam Sơn</option>
                     <option value="Khách hàng">Khách hàng</option>
                </select></td>
            <td>Diễn giải :</td>
            <td><span class="AddNew"><input type="text"  name="ChuThich" id="ChuThich" size="10"/></span></td>
        </tr>
        <tr>
            <td style="padding-left:10px">Bao bì bốc vác:</td>
            <td><span class="AddNew"><input type="text" name="BBBV" /></span></td>
            <td>Thanh toán trước</td>
            <td><span class="AddNew"><input type="text" name="ThanhToanTruoc" id="ThanhToanTruoc" /></span></td>
            <td>Hình thức TT</td>
            <td><span class="AddNew"><input type="text" name="HinhThucTT" id="HinhThucTT" /></span></td>
        </tr>
        <tr>
            <td>Trả cước TB :</td>
            <td><%: Html.CheckBox("TraCuocTB",false) %></td>
            <td>Trả cước VC :</td>
            <td><%: Html.CheckBox("TraCuocVC",false) %></td>
            <td></td>
            <td></td>
        </tr>
        <tr>
            <td colspan="6"><div class="Submit">
        	<ul>
            	<li class="Cancel"><a href="javascript:SubmitButton('cancle')">Hủy</a><input type="reset" style="display:none" name="btnCancel"/></li>
                <li class="Adds"><a href="javascript:SubmitButton('add')">Thêm</a><input type="submit" style="display:none" name="btnAdd" /></li>
            </ul>
        </div></td>
        </tr>
        </table>        
         
        <%
       }
        
   }
    %>
   